﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using AutoFacUtils;
using CashFlow.Web.Filters;
using CashFlow.Web.Service;
using IShopPerformanceService2 = CashFlow.Web.Areas.ShopManage.Service.IShopPerformanceService;

namespace CashFlow.Web.Areas.ShopManage.Controllers
{
    [ShopManagerFilter]
    public class ShopController : Controller
    {
        private IUserService GetUserService() { return AutoFacHelper.Get<IUserService>(); }
        private IShopPerformanceService2 GetShopPerformanceService2() { return AutoFacHelper.Get<IShopPerformanceService2>(); }

        // GET: ShopManage/Shop
        public ActionResult Index()
        {
            var service = GetUserService();
            var shopInfo = service.GetLoginShopInfo();
            var ui = service.GetLoginUser();
            ViewBag.ShopInfo = shopInfo;
            ViewBag.UserInfo = ui;

            return View();
        }

        public ActionResult ShopPerformance()
        {
            var userService = GetUserService();
            var ui = userService.GetLoginShopInfo();
            var shopPerformanceService2 = GetShopPerformanceService2();
            var ls = shopPerformanceService2.QueryByShopManagerUserId(
                        ui.ShopManagerUserId
                     );
            ViewBag.ShopPerformanceList = ls;
            return View();
        }
    }
}